<?php
class Buy extends Controller {
	public function html() {
		$tid = $this->get('tid', 'int');//门票ID
		if(!$tid) header("location: /category/");
		
		$mUser = new User_model();
		$currUser = $mUser->currUser();
		if(!$currUser) header('location:/user/login/?backurl='.urlencode('/deal/buy/'.$tid.'.html'));
		
		//门票信息
		$mTicket = new Ticket_model();
		$params = array('tid' => $tid);
		$data['ticket'] = $mTicket->info($params);
		
		//景点信息
		$mProduct = new Product_model();
		$data['product'] = $mProduct->productInfo(array('id' => $data['ticket']['product_id']));
		$data['tid'] = $tid;
		$tpl = 'deal/buy.html';
		$this->display($data, $tpl);
	}
}
